import { request } from '@/utils/request';

// 获取路由信息
export function getRouters() {
  return request.get({
    url: '/system/menu/getRouters',
  });
}

// 查询菜单列表
export function listMenu(query?: any) {
  return request.get({
    url: '/system/menu/list',
    params: query,
  });
}

// 查询菜单详细
export function getMenu(menuId: string | number) {
  return request.get({
    url: '/system/menu/' + menuId,
  });
}

// 查询菜单下拉树结构
export function treeselect() {
  return request.get({
    url: '/system/menu/treeSelect',
  });
}

// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId: string | number) {
  return request.get({
    url: '/system/menu/roleMenuTreeSelect/' + roleId,
  });
}

// 新增菜单
export function addMenu(data: any) {
  return request.post({
    url: '/system/menu',
    data: data,
  });
}

// 修改菜单
export function updateMenu(data: any) {
  return request.put({
    url: '/system/menu',
    data: data,
  });
}

// 删除菜单
export function delMenu(menuId: string | number) {
  return request.delete({
    url: '/system/menu/' + menuId,
  });
}
